<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script type="text/javascript" charset="UTF-8" src="../../js/Vue.js-v2.6.10.js"></script>
	</head>
	<body>
		
		<div id="vue-app">
			<input type="text" @keyup.media-play-pause="method" @keyup.86="clickKeyV" @keyup.v="warnCodeV($event)" @keyup.81="clickKeyQ"/>
			<!-- 同一个触发事件先绑定的事件函数先触发 -->
		</div>
		
		<script type="text/javascript">
			
			/* 用来自定义键位别名 */
			
			/* eg */
			Vue.config.keyCodes = {
				// v: 86,  // 按键"v"的键值标准值为"86"
				v: 81,  // "81" 按键值对应的按键是 "q"  此时无法触发 warnCodeV
				f1: 112,
				// camelCase 不可用
				mediaPlayPause: 179,
				// 取而代之的是 kebab-case 且用双引号括起来
				"media-play-pause": [179,13],
				up: [38,87]
			}
			Vue.config.performance = true;
			
			var vm = new Vue({
				el: "#vue-app",
				data: {
					
				},
				methods: {
					method: function(){
						console.log("1")
					},
					warnCodeV: function(e){
						var keyVal = e.keyCode;
						console.log(keyVal);
						console.log("v键被触发")
					},
					clickKeyV: function(){
						console.log("86键值被触发")
					},
					clickKeyQ: function(){
						console.log("81键值被触发")
					}
				}
			})
		</script>
	</body>
</html>